<template>
  <el-tree :data="treeData" :props="defaultProps" :expand-on-click-node="false" @node-click="handleNodeClick"   :default-expanded-keys="[1]"  node-key="id"></el-tree>
</template>

<script>
export default {
  name: "commonOrgTree",
  data() {
    return {
      treeData: [],
      defaultProps: {
        children: 'childOrgTreeVOS',
        label: 'orgName'
      },
      selectNode:null,
    };
  },
  methods:{
    handleNodeClick(data) {
      this.selectNode = data
      this.$emit('getSelectNode',data)
    },
    getOrgTree(){
      this.$api.getOrgTree().then(res=>{
        this.treeData = [res.data]
      })
    },
  },
  mounted() {
    this.getOrgTree();
  },
}
</script>

<style scoped lang="less">
.el-tree{
  background-color: transparent;
  border-right: 1px solid #eee;
}
</style>